package top.mataiji.manager.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.mataiji.manager.mapper.Order_detailsMapper;
import top.mataiji.manager.pojo.Order_details;
import top.mataiji.manager.service.Order_detailsService;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @Auther: zhaoss
 * @Date: 2021/3/19 - 03 - 19 - 15:08
 * @Description: top.mataiji.manager.service.impl
 * @version: 1.0
 */
@Service
public class Order_detailsServiceImpl implements Order_detailsService {

    @Autowired
    Order_detailsMapper order_detailsMapper;


    @Override
    public int addOrder_details(ArrayList<Order_details> order_details) throws Exception {
        if(order_details.isEmpty()||order_details==null){
            throw new Exception();
        }
        int i=0;
        Iterator<Order_details> iterator = order_details.iterator();
        while (iterator.hasNext()){
            i = order_detailsMapper.insertSelective(iterator.next());
        }
        return i;
    }
}
